#include <bits/stdc++.h>
using namespace std;

int main() {
    int n; cin >> n;
    vector<int> a(n);
    for (int& x : a) cin >> x;
    vector<int> pre(n+1);
    for (int i=1; i<=n; ++i) pre[i] = pre[i-1] + a[i-1];
    
    vector<int> l(pre[n]+1, -1), r(pre[n]+1, -1);
    
    for (int i=2; i<=n; ++i) {
        int pc = a[i-2], cc = a[i-1];
        int ps = pre[i-2]+1, cs = pre[i-1]+1;
        for (int j=0, ch=cs; pc-- && cc>0; ++j) {
            int p = ps + j;
            l[p] = ch++;
            cc--;
            if (cc) {
                r[p] = ch++, cc--;	
			}
        }
    }
    
    cout << "1"<<endl;
    for (int i=1; i<=pre[n]; ++i)
        cout << l[i]<<" "<<r[i]<<endl;
    return 0;
}
